DisplayObject seemingly randomly flips while setting transformationMatrix

Under certain circumstances (that only the Gods of Matrix Math understand) when setting transformationMatrix, the display object will flip (invert scale) in both in the X and Y directions.  This is not desirable when the user has stored off stateful variables and is trying to make comparisons over time, as is often the case with drag-and-rotate touch handlers.

I have such a drag-and-rotate handler, and the object being rotated erratically flips without my fix. With the fix, it behaves perfectly.

The alternative (which I suspect many people have implemented) is to detect this flip condition after setting the transformation matrix, but that's cumbersome at every assignment.