NBA rules say:
Rule 8, Section II:
b. Any ball that rebounds or passes
directly behind the backboard, in either direction, from any point is considered out-of-bounds.
and FIBA is quite different too:
23.1.2 The ball is out-of-bounds when it
touches [...] the backboard supports, the back of the backboards or any object above the playing court.