Decomposition of a nonsquare affine matrix I have a $2\times 3$ affine matrix 
$$
M = \pmatrix{a &b &c\\ d &e &f} 
$$
which transforms a point $(x,y)$ into $x' = a x + by + c, y' = d x + e y + f$
Is there a way to decompose such matrix into shear, rotation, translation,and scale ? I know there's something for $4\times 4$ matrixes, but for a $2\times 3$ matrix ?

If $(x, y, 1)$ is a vector in homogeneous coordinates, we have, by decomposing $M$ into blocks, that
$$M \left[\begin{array}{c}x\\y\\1\end{array}\right] = \left[\begin{array}{cc} a& b\\ d&e\end{array}\right]\left[\begin{array}{c}x\\y\end{array}\right] + \left[\begin{array}{c}c\\f\end{array}\right].$$
Here $(c,f)$ is the translation component. We can decompose the 2x2 matrix into a composition of a rotation, shear, and scale by using the QR decomposition:
$$\begin{align*}\left[\begin{array}{cc}a & b\\d & e\end{array}\right] &= \left[\begin{array}{cc} \cos \theta &-\sin \theta \\ \sin\theta &\cos \theta\end{array}\right]\left[\begin{array}{cc} \sqrt{a^2+d^2} & b\cos \theta + e\sin \theta\\0 & e\cos \theta - b\sin \theta\end{array}\right]\\
&=\left[\begin{array}{cc} \cos \theta &-\sin \theta \\ \sin\theta &\cos \theta\end{array}\right]\left[\begin{array}{cc}1 & \frac{b\cos \theta + e\sin\theta}{e\cos \theta-b\sin\theta}\\0 & 1\end{array}\right]\left[\begin{array}{cc}\sqrt{a^2+d^2} & 0\\0 & e\cos\theta - b\sin\theta\end{array}\right],\end{align*}$$
where $\theta = \arctan\left(\frac{d}{a}\right).$
