Phase Recovery Guarantees from Designed Coded Diffraction Patterns in Optical Imaging