Fix transformation sequence to correctly handle combined rotate and scale commands.

Closes #583