There is good shame and bad shame. If you murder someone, then you should rightly feel shame. If you are gay, then you should not feel shame. Shame can work both ways.
With murder it's not really shame you should feel but sadness and regret about what you did to someone else. Those feelings target the victims directly, not society as a whole which has very little to do with this.
Of course if someone commits premeditated murder, they are well beyond shame being an influence on their behavior anyway. There are much more forceful consequences like a prison sentence that they also ignored.
I cant help but feel the golden rule gets you most of the way there, treat others as youd want to be treated. Of course tgere will still be gray areas on the edges, but debating whether you should beat someone for being gay shouldnt be an ethical conundrum.