in reply to Checking if squares intersect

Something similar was discussed on PerlMonks in 2001: Line intersection, scaled to thousands of points.

That article contained a link to a downloadable chapter from "Mastering Algorithms with Perl" called Geometric Algorithms.
Look for the "bounding_box_intersect" subroutine.

Searching CPAN, I found a package that might do the trick: Math-Geometry-Planar, which has a routine "GpcClip" which can find the intersection of two polygons.