This factorization was Lemma 3 in K.R. Matthews and R.F.C. Walters, Some properties of the continued fraction expansion of (m/n)e 1/q, Proc. Camb. Phil. Soc. 67 (1970) 67-74 and is a version of Satz 4.1. of Die Lehre von den Kettenbrüchen, Band 1, S. 111.
(Lemma 3 of that paper stated that -c22 < c12 ≤ c11, which is true if q > 0 or s > 0.)