Detects collisions between two rectangles