From a mathematical point of view the solution to this isn't that hard. What I write here is NOT GML. It's mathematical explanation of how that point is going to be calculated (for people who are interested):

m = (y2 - y1)/(x2-x1) // The slope of the line

y = mx + b // The line equation

Any point on a line fits its equation. So the collision point (which IS on the line) is going to fit as well.

Case 1: Now we know that the x coordinates of the collision point (if it is on the right or left) is going to be the same as the x of the center point of the rectangle + (or minus) the width/2.

**Case 2:** The same is true for the y coordinates of the collision point if it is on top or down side of the rectangle. If that's the case then the y of the center point of the rectangle + (or minus) the height/2 is going to be the y.

For the case 1 we can use the ordinary equation (y=mx+b). In this case there is no "b" because the line is always on the center point where b=0. Here is the solution for case 1:

y = (y2 - y1)/(x2 - x1) * (x1 + width/2) // for the right side

y = (y2 - y1)/(x2 - x1) * (x1 - width/2) // for the left side

For the case 2 we need to alter the ordinary equation:

y = mx + b ===> x = y/m - b

Here we have the y and want to calculate the x (and still there is no "b"):

x = (y1 - height/2) / (y2 - y1)/(x2 - x1) // for the up side

x = (y1 + height/2) / (y2 - y1)/(x2 - x1) // for the down side

I'm not sure how to do this in GMS1.4 (or GMS2) because the latest version I used was 7. Although the programming solution to this is already provided, I thought it might be cool if I provide a mathematical explanation for you.