I believe I see 2 solutions for this problem. First let's redefine $D$ algebraicly as $D=10A+B$. So our equation is
$(A+B)^2-10A-B=27$
I don't know if you know any modular arithmetic. You may at least be aware of the divisibility test for $9$. The sum of the digits of a number is closely related to its remainder when divided by $9$. So it is a reasonable guess that we try to determine the remainder of both sides when divided by $9$. This simplifies the equation to
$(A+B)^2-A-B\equiv0\pmod9$ $(A+B)^2-(A+B)\equiv0\pmod9$ $(A+B)(A+B-1)\equiv0\pmod9$
So we have the product of 2 consecutive integers has a remainder of $0$ when divided by $9$, or in other words this product is divisible by $9$. Since 2 consecutive numbers share no common factors besides $1$, either $A+B$ is divisible by $9$, or $A+B+1$ is divisible by $9$. $D=99$ is too large and $D=10$ is too small, leaving 2 possibilities.
Our first possibility is $A+B=9$. This gives us
$S=9^2=81$ $D=S-27=81-27=54$
Our second possibility is $A+B-1=9$ or $A+B=10$. This yields
$S=10^2=100$ $D=S-27=100-27=73$
Both values check out. $D$ is either $54$ or $73$.