http://frederic-wang.fr/decomposition-of-2d-transform-matric...
i mostly copy-pasted the js code from this page as a contribution to this lib back in the day: https://github.com/epistemex/transformation-matrix-js