Hello Juan
In standard IEEE 802.1D STP, all active ports send out BPDUs except root ports and blocked ports. So designated ports are able to send BPDUs while root ports and blocked ports only receive BPDUs.
Now having said that, in the situation you are describing in your post, the Gi0/1 interface of SW4 sends out a BPDU that is received on Gi0/2 of SW2. So in this scenario, at this point in time, SW4 believes itself to be the root bridge.
All of the ports of a root bridge are, by definition, designated ports. Therefore, the BPDU that’s sent from SW4 is sent from a designated port, so it does indeed conform to the rules of STP. Does that make sense?
I hope this has been helpful!
Laz