Given two matrices $A$ and $B$ with random dimensions, I want to find the largest common sub-matrix, in the sense of the dimension(e.g. $M_{p,q}$ has larger dimension than $N_{s,t}$ iff $p\geq s$ and $q\geq t$). How could I understand this problem in math, or are there some models based on such a problem.
PS: The above problem comes from the image processing, i.e. finding the common area of the two pictures. And, I just knew the brute-force method.