Design and Characterization of a Monolithic CMOS Phase-Sensitive Pixel Based on an Avalanche Photodiode