Arbitrary transformation matrices

The application I am working with provides raw transformation matrices for a lot of the operations it wants to do, many of which are based on the primitive transformations (rotate, translate, scale, etc), however, quite a few of them have already been pre-optimized and rather than trying to divine the original pairs and triplets of matrices, I opted to implement a generic transformation matrix method, both for 3x3 and 4x4 (3x3+translation) matrices.

This code uses the matrix application from the rotate method, and we could easily make rotate() use this matrix method to reduce duplication.