account for negative-width and -height rectangles in rectangle collisions, correctly calculate intersection point for line-to-rectangle collisions