area formed by a box and line suppose we have a box defined by coordinates $(1,1)$, $(-1,1)$, $(-1,-1)$, $(1,-1)$.
Suppose, a line $y=m(x+b)$ crosses the box with $m>0$ and $b>0$. What is the area of left upper triangle.  Assume that the line crosses the box. 
Thank you very much. 
Partial Answer:
the line intersects a box at $(x,y)=(\frac{1}{m}-b,1)$ and $(x,y)=(-1,m(b-1))$
Area is formed by $(-1-(\frac{1}{m}-b)) \cdot (1-m(b-1))$ ,correct?

The box that is defined by coordinates $(1,1), (-1,1), (-1,-1), (1,-1)$ is the following:

To draw also the line $y=m(x+b) $ :
For $x=-1: y=m(-1+b)$
For $y=1: x=\frac{1}{m}-b$
Let's suppose that the line intersects the box as followed:

So we want to find the area of the yellow region.
$A(-1,1), B(\frac{1}{m}-b,1), C(-1, m(-1+b))$
$(AB)=\sqrt{(1-1)^2+(\frac{1}{m}-b+1)^2}=\frac{1}{m}-b+1$
$(AC)=\sqrt{(m(-1+b)-1)^2+(-1+1)^2}=m(-1+b)-1$
$$\text{ Area }=\frac{1}{2} (AB)(AC)=\frac{1}{2} \left (\frac{1}{m}-b+1 \right ) \left (m(-1+b)-1 \right )$$
