X-ray diffraction of photovoltaic perovskites: Principles and applications