Astrophysics And Cosmology With Spectroscopic And Photometric Intensity Mapping