So I'll most likely just perform the steps in what feels to me like the incorrect order.
Here's an anecdote from about 1990:
A friend was on a transatlantic flight, and the guy sat next to him had a laptop computer - which was a bit of a novelty at the time, and since this was before at-seat power, he also had a large bag of batteries to swap. (Yes, removable batteries!).
My friend was of course watching what the guy was doing. He seemed to be writing 3D graphics code. He would hack around for a bit, then run it, quietly swear, and repeat.
Eventually, my friend had to say something. "Excuse me", "Huh, yeah?", "You're multiplying the matricies in the wrong order. Swap A and B on line 481."
Anyway.
I don't recall the semantics of the Core Graphics transformation functions. There are definitely two ways of thinking about it. My preference with any API of this sort is to form the complete matrix myself and call a single API function to set it. Then I'm in control of what happens and I don't need to worry about whether this particular library does AxB or BxA.
Beware that that's not the only way it can go wrong. There is one affine transformation API - I forget which one, maybe it's SVG? - where rotations are about the center of the image, not the origin!
Good luck.