How could David say to God—after sleeping with Uriah's wife and then killing him—"Against you and you only have I sinned"?
Sin, by definition in the Bible, is not wronging another person. It is assaulting the glory of God, rebelling against God. Sin, by definition, is a vertical phenomenon.
These horizontal wrongs are horrible: murder, rape, the death of a baby that David elicits. That's horrible and wrong (and it's not wrong to call it sin). But the thing that makes it sin is its vertical dimension. It is disobeying God's law. It is denying that he satisfies your soul to keep you from needing to kill or rape. It is sin in that it is an assault on God's authority and his right to tell you what to do.
What makes sin sin is its Godwardness. That's why the world doesn't understand how serious hell is, because they don't understand how serious sin is. And they don't understand how serious sin is because the only way the world thinks about sin is in terms of "You hurt me and I hurt you, and that shouldn't be." And that's true: we shouldn't hurt each other. But they don't even bring God into the picture, and that's where sin becomes sin.
So when David says, "Against you and you only have I sinned," I don't think he means, "I didn't wrong Uriah by killing him, and I didn't wrong Bathsheba by raping her, and I didn't wrong the baby by being the cause of its death." He meant, "The horrible thing here, ultimately, is that I rebelled against God. I rejected God as my treasure. I scorned the word of God." This is what Nathan said to him when he came and pointed the finger at him: "Why have you despised the word of God?" That's what Nathan said. Nathan didn't say, "Why have you killed a man, and why have you raped a woman?" He said, "Why have you despised the word of God?"
So David knows from the prophet that the worst thing that has happened here is that he has despised God. And so I think that's what he means. He is simply drawing attention, not to the minimization of rape and murder, but to the maximization of the assault on God that happened in those acts.
They are not less horrible because he says this: they are more horrible because he says this.