Original code
Add isNaN checks, for compatibility
Don't shadow setTransform, so we can use it
Add an inverted transform

This will transform element-relative coordinates to in-canvas
coordinates, yay!