Factor out transform matrix setup code
We use the same or similar code in several places to set up a transform matrix. Let's pull out the common bits and try to simplify a bit.
We use the same or similar code in several places to set up a transform matrix. Let's pull out the common bits and try to simplify a bit.