Amazon Interview Question

How would you detect a collision between two rectangles