http://www.sevenson.com.au/actionscript/sat/

https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection