Working with rotated Object2D and mouse positions

I found this thread when searching for my own answers so I bookmarked it in case I had any luck. Hopefully it will work for you. The collision test is based on two factors. The first is simply checking if either rect contains the other’s counterpoint. This should cover creating a sprite totally enclosed by another. The other is corner points contained by the other rect. This should cover collisions once the sprites are in place. One edge case that will fail is if you have to long rectangles that are created which are crossed at a point not involving the centerpoint or any of the corner points. For my needs this would occur rarely, if ever. The sample app checks for collision on creating and placing the sprite. It then checks as you drag any of the rectangles. The code is pretty straightforward.

Prior to being given this example project, I believe I already got everything covered apart from the maths behind the rotation. You can use the Contains function with the RectShape class.