Understanding the interplay of surface structure and work function in oxides: A case study on SrTiO3