Reconstruction from Periodic Nonlinearities, With Applications to HDR Imaging