  We prove a theorem that allows one to count solutions to determinant
equations twisted by a periodic weight with high uniformity in the modulus. It
is obtained by using spectral methods of $\operatorname{SL}_2(\mathbb{R})$
automorphic forms to study Poincar\'e series over congruence subgroups. By
keeping track of interactions between multiple orbits we get advantages over
the widely used sums of Kloosterman sums techniques. We showcase this with
applications to correlations of the divisor functions twisted by periodic
functions and the fourth moment of Dirichlet $L$-functions on the critical
line.
