$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
\newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
\newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
\newcommand{\dd}{\mathrm{d}}
\newcommand{\ds}[1]{\displaystyle{#1}}
\newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
\newcommand{\ic}{\mathrm{i}}
\newcommand{\mc}[1]{\mathcal{#1}}
\newcommand{\mrm}[1]{\mathrm{#1}}
\newcommand{\pars}[1]{\left(\,{#1}\,\right)}
\newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
\newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
\newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
\newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
\mathcal{S} & \equiv
\sum_{n = 1}^{\infty}{\sin\pars{n\pi y}\sin\pars{n\pi x} \over n^{2}\pi^{2}} =
\sum_{n = 1}^{\infty}xy\,\mrm{sinc}\pars{n\pi\verts{y}}\,\mrm{sinc}\pars{n\pi\verts{x}}
\\[5mm] & =
-xy +
xy\sum_{n = 0}^{\infty}
\mrm{sinc}\pars{n\pi\verts{y}}\,\mrm{sinc}\pars{n\pi\verts{x}}
\end{align}
The series is evaluated with the
Abel-Plana Formula when
$\ds{\verts{x} + \verts{y} < 2}$ as I'll explain below. In any other case, we can use the periodic properties of the $\ds{\sin}$-function to render the arguments "inside the convergent region".
The Abel-Plana formula can be used when
the following expression vanishes out as $\ds{\Im\pars{z} \to \pm\infty}$:
\begin{align}
&xy\,\mrm{sinc}\pars{z\pi\verts{y}}\,\mrm{sinc}\pars{z\pi\verts{x}}
\expo{-2\pi\verts{\Im\pars{z}}}
\\[5mm] \stackrel{\mrm{as}\ \Im\pars{z}\ \to\ \pm\infty}{\sim}\,\,\,&
\pm\,{\mrm{sgn}\pars{xy} \over 4\pi^{2}}
\exp\pars{\rule{0pt}{4mm} -\bracks{\rule{0pt}{6mm}2 - \verts{x} - \verts{y}}\pi\verts{\Im\pars{z}}}
\,\,\,\stackrel{\mrm{as}\ \Im\pars{z}\ \to\ \pm\infty}{\to}\,\,\, {\Large 0}
\\[2mm] &\ \bbx{\mbox{when}\ \verts{x} + \verts{y} < 2}
\end{align}
Then,
\begin{align}
\mathcal{S} & \equiv
\sum_{n = 1}^{\infty}{\sin\pars{n\pi y}\sin\pars{n\pi x} \over n^{2}\pi^{2}}
\\[5mm] & =
-xy + xy\int_{0}^{\infty}\mrm{sinc}\pars{n\pi\verts{y}}
\,\mrm{sinc}\pars{n\pi\verts{x}}\dd n +
xy\bracks{{1 \over 2}\mrm{sinc}\pars{n\pi\verts{y}}\,\mrm{sinc}\pars{n\pi\verts{x}}}
_{\ n\ =\ 0}
\\[5mm] & =
-\,{1 \over 2}\,xy + {xy \over \pi}\int_{0}^{\infty}\mrm{sinc}\pars{n\verts{y}}
\,\mrm{sinc}\pars{n\verts{x}}\dd n
\\[5mm] & =
-\,{1 \over 2}\,xy + {xy \over \pi}\braces{\pi\,{\verts{x} + \verts{y} - \verts{\rule{0pt}{5mm}\verts{x} - \verts{y}} \over 4\verts{x}\verts{y}}}
\\[5mm] & =
\bbx{\mrm{sgn}\pars{x}\mrm{sgn}\pars{y}
\min\braces{\verts{x},\verts{y}} - xy \over
2}
\end{align}