Reconstructing Transient Images from Single-Photon Sensors