Direct determination of the size distribution of arbitrary surface configurations from diffraction measurements: General theory