Turn screen off if tilted a certain way
Device is vertically upside down.
  Device is locked in Portrait mode and horizontal.
  Screen is facing the center of the Earth.
  


I suggest you try Automate (user guide) as well as Tasker (free trial; user guide). Both of them offer the features you're seeking. A peek:

(Click an image to enlarge it)





Before I leave you here to tinker with those options, here is some information to ease the tinkering:

In Automate app:


Device Orientation block can be found under Sensors.
Device lock can be found under Interface. Practical usage requires setting Automate as device administrator.


Tip: It is easy in Automate to trigger an action on a prerecorded motion gesture

In Tasker app:


Orientation trigger can be found under State &rarr; Sensor.
Display Orientation trigger can be found under State &rarr; Display. 
System Lock action can be found under Display.


Tip: In Tasker you can setup multiple contexts.