Amplitude analysis and branching fraction measurement of the decay $D^0 \to K^0_Sπ^0π^0$