Given a $\vartheta$-function, $$ \vartheta\Big[\genfrac{}{}{0pt}{}{\frac{p}{q}}{0} \Big](0|q\,\tau) = \sum_{n\in \mathbb{Z}} e^{i \pi (n + \frac{p}{q})^2 q\,\tau} $$ where $p = 0,1,\cdots,q-1$ and $q$ is an integer $\geq 1$. I want to prove that $$ \vartheta\Big[\genfrac{}{}{0pt}{}{\frac{p}{q}}{0} \Big](0|-\frac{q}{\tau}) = \frac{1}{\sqrt{q}}\sum_{k=0}^{q-1}e^{-\pi i \frac{k\,p}{q}}\,\vartheta\Big[\genfrac{}{}{0pt}{}{\frac{k}{q}}{0} \Big](0|q\,\tau) $$
Now for $q = 1$, I know how to show this using Poisson summation, but I don't understand where the sum over $k$ comes from when $q>1$. I've looked in the literature on $\vartheta$-functions but I haven't found anything that helps me prove this. This is a specific instance of a modular transformation so it should probably be an established result.