diff --git a/include/QF/mathlib.h b/include/QF/mathlib.h
index fac968396..3d1c82ec5 100644
--- a/include/QF/mathlib.h
+++ b/include/QF/mathlib.h
@@ -611,8 +611,18 @@ void Mat4Init (const quat_t rot, const vec3_t scale, const vec3_t trans,
 void Mat4Transpose (const mat4_t a, mat4_t b);
 void Mat4Mult (const mat4_t a, const mat4_t b, mat4_t c);
 void Mat4MultVec (const mat4_t a, const vec3_t b, vec3_t c);
-// Column major matrix
-int Mat4Decompose (const mat4_t m, quat_t rot, vec3_t scale, vec3_t shear,
+/** Decompose a column major matrix into its component transformations.
+
+	This gives the matrix's rotation as a quaternion, shear, scale
+	(XY, XZ, YZ), and translation. Using the following sequence will give the
+	same result as multiplying \a v by \a mat.
+
+	QuatMultVec (rot, v, v);
+	VectorShear (shear, v, v);
+	VectorCompMult (scale, v, v);
+	VectorAdd (trans, v, v);
+*/
+int Mat4Decompose (const mat4_t mat, quat_t rot, vec3_t shear, vec3_t scale,
 				   vec3_t trans);
 
 #define BOX_ON_PLANE_SIDE(emins, emaxs, p)				\
diff --git a/libs/util/mathlib.c b/libs/util/mathlib.c
index f6918a145..f4faf940d 100644
--- a/libs/util/mathlib.c
+++ b/libs/util/mathlib.c
@@ -854,7 +854,7 @@ Mat4MultVec (const mat4_t a, const vec3_t b, vec3_t c)
 }
 
 int
-Mat4Decompose (const mat4_t m, quat_t rot, vec3_t scale, vec3_t shear,
+Mat4Decompose (const mat4_t mat, quat_t rot, vec3_t shear, vec3_t scale,
 			   vec3_t trans)
 {
 	vec3_t      row[3], shr, scl;
@@ -863,7 +863,7 @@ Mat4Decompose (const mat4_t m, quat_t rot, vec3_t scale, vec3_t shear,
 
 	for (i = 0; i < 3; i++)
 		for (j = 0; j < 3; j++)
-			row[j][i] = m[i * 4 + j];
+			row[j][i] = mat[i * 4 + j];
 
 	l = DotProduct (row[0], row[0]);
 	if (l < 1e-5)
@@ -896,7 +896,7 @@ Mat4Decompose (const mat4_t m, quat_t rot, vec3_t scale, vec3_t shear,
 	if (shear)
 		VectorCopy (shr, shear);
 	if (trans)
-		VectorCopy (m + 12, trans);
+		VectorCopy (mat + 12, trans);
 	if (!rot)
 		return 1;
 
diff --git a/libs/util/test/test-mat.c b/libs/util/test/test-mat.c
index 2d711e38c..8e921e320 100644
--- a/libs/util/test/test-mat.c
+++ b/libs/util/test/test-mat.c
@@ -72,7 +72,7 @@ test_angle (const vec3_t angles)
 
 	AngleQuat (angles, rotation);
 	QuatToMatrix (rotation, mat, 1, 1);
-	Mat4Decompose (mat, r, scale, shear, trans);
+	Mat4Decompose (mat, r, shear, scale, trans);
 	for (i = 0; i < 4; i++)
 		if (!compare (rotation[i], r[i]))
 			goto negate;
@@ -145,7 +145,7 @@ test_transform2 (const vec3_t angles, const vec3_t scale,
 	VectorAdd (translation, x, x);
 
 	Mat4Init (rotation, scale, translation, mat);
-	Mat4Decompose (mat, rot, sc, sh,  tr);
+	Mat4Decompose (mat, rot, sh, sc, tr);
 
 	VectorCopy (v, y);
 	QuatMultVec (rot, y, y);