I searched the scripting API but I can’t find the sprite’s Width and Height variables (which are different from the rect that contains the sprite). Any clues?
This will return the rect that contains those values:
var rect = GetComponent<SpriteRenderer>().sprite.rect
It has x, y, width, and height values that correspond with the values in your screenshot.