We consider a fading channel in which a multi-antenna transmitter communicates with a multi-antenna receiver through a reconfigurable intelligent surface (RIS) that is made of N reconfigurable passive scatterers impaired by phase noise. The beamforming vector at the transmitter, the combining vector at the receiver, and the phase shifts of the N scatterers are optimized in order to maximize the signal-to-noise-ratio (SNR) at the receiver. By assuming Rayleigh fading (or line-of-sight propagation) on the transmitter-RIS link and Rayleigh fading on the RIS-receiver link, we prove that the SNR is a random variable that is equivalent in distribution to the product of three (or two) independent random variables whose distributions are approximated by two (or one) gamma random variables and the sum of two scaled non-central chi-square random variables. The proposed analytical framework allows us to quantify the robustness of RIS-aided transmission to fading channels. For example, we prove that the amount of fading experienced on the transmitter-RIS-receiver channel linearly decreases with N1. This proves that RISs of large size can be effectively employed to make fading less severe and wireless channels more reliable.