Two-photon spectra of quantum systems