ViewportTransform trouble

So I'm finding myself a little stuck after making the viewporttransform demo. I've implemented the same type of transformations in a different drawing environment, and it worked just fine, but for some reason the worldMouse is not getting set correctly at all. It almost seems like it gets rotated twice.

Also it seems like the images aren't getting rotated properly, which is strange because they scale from the same matrix they should be rotating from.

Let me know if you have any ideas, or if you see what's wrong.

Thanks

Original thread: https://box2d.org/forum/viewtopic.php?t=3574