B must be 2 or 8, because the squares of these numbers end in 4. So the product is either 24024 or 84084.
1078×78=84084, so AB=78.
The full solution is:
(1000+10A+[²₈])(10A+[²₈])=[²⁴⁰²⁴₈₄₀₈₄] where alternatives are shown in brackets [ ].
100A²+[¹⁰⁰⁴⁰₁₀₁₆₀]A+[²⁰⁰⁴₈₀₆₄]=[²⁴⁰²⁴₈₄₀₈₄]
100A²+[¹⁰⁰⁴⁰₁₀₁₆₀]A-[²²⁰²⁰₇₆₀₂₀]=0
5A²+[⁵⁰²₅₀₈]A-[¹¹⁰¹₃₈₀₁]=0=(5A+543)(A-7) is the only factorisation, so A=7.