A former PE teacher at a private school in Edinburgh exploited his position of trust to physically and sexually abuse young boys, a court has ruled.