Why we can't use sum of squares dp? (SOLVED)

Problem: https://leetcode.com/problems/tiling-a-rectangle-with-the-fewest-squares/
Why can’t we convert this problem into finding out minimum number of number(or tiles) whose sum of their squares is equal to n*m, where size(or length) of tiles can be 1 to min(n,m).
In other words, in this :=> https://leetcode.com/problems/perfect-squares/

After trying some test cases, I got the reason why this can’t be the solution.
The reason being 11X13 = 143.
Here, according to my logic, it will give 7, 7, 6, 3 whose sum of squares is 143 which is minimum numbers to form the answer. But actually, we can’t fit two 7 length square in the given space. The logic of sum of squares doesn’t care about wether we can fit the current number or not(like 7 again).

n=1, m=9
Correct answer = 9
Your Answer = 1

its will be 9 acc to my logic. I am restricting the size of tiles that can be use is min(n,m) which will be 1.
So, problem will become what is minium number of tiles of size 1 that can use used (square of it) to make 9, which it will evaluate 9.
SOLUTION in description of the question of this post above.