Measuring the quantum geometric tensor in two-dimensional photonic and exciton-polariton systems