I have came across a challenging question I'd to solve. I am a self-taught man, so be indulgent.
Caution: the following is a translation from a non English language. Sorry if it contains syntax inaccuracies.
Let A be a matrix with n rows and m columns such as: $\forall i, j: 1 ≤ i ≤ n, 1 ≤ j ≤ m$
Let B be a submatrix of A with d rows and d columns defined as: $\exists p, q: B[i,j] = A[p + i - 1, q + j - 1]$ $\forall i,j 1 ≤ i ≤ d, 1 ≤ j ≤ d$
So B is a part (as a square) of the image of A
Question: demonstrate how many submatrices B with d rows and d columns A contain?