Collision detection and on which side the collision happened for rectangles