Measurements of the branching fractions of B0 -> K*0 K+ K-, B0 -> K*0 pi+ K-, B0 -> K*0 K+ pi-, and B0 -> K*0 pi+ pi-