Draw two rectangles: a large one ABCD has sides 6x (=AB=DC) by 3x (=BC=AD), the other EFGH sits inside it, having the same width (EF=AB=DC=HG=6x) but length (FG=EH) 12. Rectangle EFGH can slide about inside ABCD. Now look at the areas. ABCD has area 6x*3x=18x^2. EFGH has area 6x*12=72x. The area inside ABCD not occupied by EFGH is 18x^2-72x no matter where EFGH sits. So let EFGH move up or down so that it is hard up against the edge of ABCD. So we will have two rectangles touching: ABGH (EFGH) and HGCD, or ABFE and EFCD (EFGH) because the common sides merge. This time we need to find out the area of one rectangle only: HGCD or ABFE. GC=HD=3x-12 or BF=AE=3x-12. So the area of either of these is 6x(3x-12). Therefore 6x(3x-12)=18x^2-72x.
There are a couple of ways of solving these simultaneous equations. The substitution method: y=1+3x from the first equation. Substitute in the second equation: 2(1+3x)-x=12, so 2+6x-x=12 and 5x=10, making x=2 and y=1+3x=7.
The other method is elimination: double the first equation: 2y-6x=2 and subtract from the second equation: 5x=10 so x=2; or triple the second equation and subtract the first: 6y-3x=36; 5y=35 so y=7. These values could be substituted in the original equations to find the other unknown.