Challenge
In this challenge, you have to fill an \$M\$ x \$N\$ rectangle grid with the most \$A\$ x \$B\$ rectangle pieces possible.
Requirements:
- The sizes of the \$M\$ x \$N\$ rectangle grid is always bigger than the sizes of the \$A\$ x \$B\$ rectangle pieces. In other words, \$min(M, N) ≥ max(A, B)\$
- You can freely rotate the \$A\$ x \$B\$ rectangle pieces.
- Those \$A\$ x \$B\$ rectangle pieces can touch each other on the edge, but it cannot overlap each other.
- Those \$A\$ x \$B\$ rectangle pieces, or part of it, cannot be outside of the \$M\$ x \$N\$ rectangle grid.
- You don't have to fill the whole \$M\$ x \$N\$ rectangle grid, because sometimes that is impossible.
Example
Given a \$5\$ x \$5\$ rectangle grid (or square) like below:
And you have to fill it with \$2\$ x \$2\$ rectangle (or square) pieces. The best you can do is \$4\$, like below:
Input/Output
Input can be taken in any resonable format, containing the size of the \$M\$ x \$N\$ rectangle grid and the \$A\$ x \$B\$ rectangle pieces.
Output can also be taken in any resonable format, containing the most number of pieces possible.
Example Input/Output:
Input -> Output
[5, 5] [2, 2] -> 4
[5, 6] [2, 3] -> 5
[3, 5] [1, 2] -> 7
[4, 6] [1, 2] -> 12
[10, 10] [1, 4] -> 24
This is code-golf, so shortest answer (in bytes) wins!