I've made sure that the size and resolution are compatible.
You can see a side by side comparison in the image. On the left is how it shows in godot editor, and on the right is how it is rendered.
I've tried pixel snapping, but it made no difference.
This is Godot 4.1 btw.