'of ' is used when we are talking about quality and such stuffs of somebody/something. Example: The colour of your dress is very good.
'for' is used when we link something to someone or vice verse. Example: I brought this book for you. It is also used for 'period of time' Example: It has been raining for two hours.
'In' is used for position, situation or time Example: He is in the room.
'at' is used for specific time, location, speed or price etc. Example: He was driving at the speed of 90 miles an hour.