Monty Python says "every sperm is sacred."  The Church is not so trite.  Non-procreative acts involving the sex organs involve more than mis-depositing sperm.  There is a mental component that goes to where one's heart lies in the act.  

Who is proud of masturbation?  Many confess; many reject the teaching because to THEM it doesn't seem sinful.  God might not be counting, but He probably isn't fond of people using their procreative organs for self-gratification and to His complete exclusion (Except at climax: "Oh, God, Oh God....")