Let's say that the origin of a coordinate system is at the center of the original black rectangle. This is the center of the rotation and also the center of each of the green rectangles. Consider only the first quadrant (from the origin up and to the right). Exactly 1/4 of the black rectangle and each green rectangle is in the first quadrant. Let's further assume that, as in your picture, the angle of rotation is relatively small (say, less than 45°) and in the clockwise direction, and that $y_1<x_1$.
Let the vertex of the black rectangle that is in the first quadrant be $(a,b)=(\frac{1}{2}x_1,\frac{1}{2}y_1)$. Call the magnitude of the angle of rotation $\alpha$ ($0°<\alpha<45°$). The coordinates of the vertex of the red rectangle in the first quadrant are $(a\cos\alpha+b\sin\alpha,-a\sin\alpha+b\cos\alpha)$. The slope of the upper side of the red rectangle is $-\tan\alpha$. An equation for the upper side of the red rectangle in the first quadrant is $y-(-a\sin\alpha+b\cos\alpha)=-\tan\alpha(x-(a\cos\alpha+b\sin\alpha))$ for $0\le x\le a\cos\alpha+b\sin\alpha$. An equivalent simplified equation is $y=\sec\alpha(b-x\sin\alpha)$. This red upper side intersects the original black upper side at $x=b\cot\alpha(\sec\alpha-1)$.
So:
- for $b\cot\alpha(\sec\alpha-1)\le x\le a$, the vertex of the green rectangle in the first quadrant will be on the red side, at $(x,\sec\alpha(b-x\sin\alpha))$, and it will have area $4x\sec\alpha(b-x\sin\alpha)$.
- for $0\le x<b\cot\alpha(\sec\alpha-1)$, the vertex of the green rectangle in the first quadrant will be on the black side (here, I'm assuming from your picture that the green rectangle must be contained entirely within the black rectangle), at $(x,b)$, and it will have area $4xb$.
- assuming that the green rectangle must be contained entirely within the black rectangle, $x$ cannot be greater than $a$.
Assuming the first case:
- the maximum area is $b^2\csc\alpha\sec\alpha$ when $x=\frac{1}{2}b\csc\alpha$.
- the green rectangle will have the same aspect ratio as the black rectangle when $x=\frac{ab}{b\cos\alpha+a\sin\alpha}$ (and the area is $\frac{4ab^3}{(b\cos\alpha+a\sin\alpha)^2}$).
edit: I originally forgot the factors of 4 on the area, moving from my picture of just one-fourth of things back to the whole rectangles. Similarly, note that my $x$- and $y$-values are half of your $x_2$ and $y_2$, respectively. The maximum possible area for the second case (where the vertex is at $(x,b)$) is $4b^2\cot\alpha(\sec\alpha-1)$, which Mathematica seems to be telling me cannot be greater than the maximum area for the first case under my assumptions about the problem.
The horizontal and vertical lines are straightforward. You get $M+N$ of those.
Let's take the lower left of the array at the origin so that the top row of points is at $y = M-1$ and the right column is at $x=N-1$.
Let's consider those diagonal lines that have positive slope, with one of the points being the origin.
We get a distinct diagonal for each pair $(x,y)$ for which $x$ and $y$ are relatively prime. (The line through $(0,0)$ and $(1,2)$ coincides with the one through $(0,0)$ and $(2,4)$.)
For counting the multiplicity, let's consider counting the lines with slope $2/3$ in a $9 \times 11$ grid.
If we start at the origin, this line goes through $(3,2)$. We can move along the $x$ axis until $(7,0)$, and after that we run out of points. We can go up a row, start at $(0,1)$ and go over again to $(7,1)$.
But if we go up to the next row, we can only go over to $(2,2)$ before we start running into points that we've drawn lines through.
However, we can continue to go up the left side. We only can go out to $x=2$ for the reason mentioned above. We can continue up to $(2,7)$, and that's the last new line for this slope.
So the formula for the number of lines with a rise of $m$ and a run of $n$ in an $M \times N$ grid is
$$L(M,N,m,n) = (m+1)(N-n) + (n+1)(M-m) - (m+1)(n+1) - 2.$$
Then, the total number of all lines (vertical, horizontal, positive slope, negative slope) is
$$T(M,N) = M + N + 2 \sum_{n=1}^{N-1} \sum_{m=1}^{M-1} L(M,N,m,n) C(m,n),$$
where $C(m,n) = 1$ if $m,n$ are coprime, and $0$ if they're not.
Best Answer
It's not clear to me what you mean by "parallel" geodesic in the hyperbolic plane. Those that meet at an infinitely distant point?
Also, it is not clear what definition of rectangle you are using. One possible definition involves having four right angles. This cannot happen in the hyperbolic plane. Indeed, the sum of interior angles in every geodesic triangle is strictly less than $\pi$. Since any quadrilateral can be divided into two triangles, the sum of its interior angles is strictly less than $2\pi$.