Filling a big rectangle with smaller rectangles While working on a crafting project I was faced with the following problem for which I did find a solution just by trying but asked myself whether there was a general solution to the following problem:
Multiple tiny congruent rectangles, each with a height of x and a width of y, are aligned such that one line of rectangles in landscape orientation forms a bigger rectangle A together with a second line of rectangles in portrait orientation. My question is how many of these tiny rectangles are at least needed to form rectangle A?

Failed approach of mine...
Area of one tiny rectangle: $$x \cdot y$$
Number of tiny rectangles: $$k = m + n$$
Area of big rectangle: $$A = k \cdot x \cdot y = (m + n) \cdot x \cdot y$$ 
also  $$(x+y) \cdot xm = (x+y) \cdot yn$$
With the information above I setup a system of linear equations:
$$ (n + m) \cdot xy = xm \cdot (x+y)$$
$$(n+m) \cdot xy = yn (x+y)$$
Which gave me the solutions
$n = \frac{mx}{y}$ and $m = \frac{ny}{x}$
As one can see the solutions are not really helpful, since $n$ is dependent on $m$ and vice verse. Is there any other way to solve this? Initially the problem seemed very simple, but now I'm just confused. So help would be greatly appreciated! Thanks in advance :-)
 A: The answer to your question is straightforward if $(x,y) \in \mathbb{Q}^2$. It equals LCM$(x,y)$, for which you can use the GCD algorithm.
A: From $mx=ny$ we see that the ration $\frac xy=\frac nm$ must be rational. And vice versa, if we can express $\frac xy$ as a fraction $\frac nm$ (in shortest terms) then a big rectangle like this with $n+m$ small rectangles can indeed be produced.
For example if $x = 7.62\,\text{cm}$ and $y=5.08\,\text{cm}$ we find that $\frac xy = 1.5 = \frac 32$, so a big rectangle $12.7\,\text{cm} \times 15.24\,\text{cm}$ can be built from $3+2=5$ rectangles. 
Of course you can also produce big rectangles that are twice, three times, etc. as high.
(If you cut a $7.62\,\text{cm}\times 5.08\,\text{cm}$ rectangle from paper and measure its sides in inches, the ration $\frac32$ will jump right into your face ;) )
A: Say the rectangle has dimensions $x \times y$. Since you require to find the first time when the vertical dimensions meet up, you are essentially adding $x$ to one side and adding $y$ to other until they are equal at some point. That is the same as finding the least common multiple  of those numbers. 
