The oxidation number of O is -2 and there's 4 of them so the total is -8. Since it's a molecule the sum of the oxidation numbers of the atoms must equal 0. If 4 oxygen atoms have an oxidation number of -8 then the two S atoms must is +8 to equal 0 so the oxidation number of the S is 8/2 = +4