It's impossible to name the structure defined in the function outside its body. So, when you specify the return type as Rectangle, this is not the Rectangle you've defined here, this is some other Rectangle defined elsewhere.
You should define the structure outside the function - i.e. the struct Rectangle { ... } part must be somewhere outside to be accessible. Of course, creating the struct - the return Rectangle { ... } statement - will stay in the function, since this seems to be your intent.