Border Lines
This is a set of simple expressions that will position four lines at the edges of a rectangular layer and maintain their relationship to the rectangle as it moves and scales.
In this example, the rectangle is named "master", the vertical lines are thin solids the height of the comp, and the horizontal lines are thin solids the width of the comp.
Apply the following expression to the position property of the lower horizontal line:
m = thisComp.layer("master");
[width/2,m.position[1] + (m.height/2)*(m.scale[1]/100)]
Apply the following expression to the position property of the upper horizontal line:
m = thisComp.layer("master");
[width/2,m.position[1] - (m.height/2)*(m.scale[1]/100)]
Apply the following expression to the position property of the right vertical line:
m = thisComp.layer("master");
[m.position[0] + (m.width/2)*(m.scale[0]/100),height/2]
Apply the following expression to the position property of the left vertical line:
m = thisComp.layer("master");
[m.position[0] - (m.width/2)*(m.scale[0]/100),height/2]